function [cResp, tl] = signal_speech(tl)

x=randperm(6);

if x(:,1)==1
    [file,sf]=audioread('aba.wav');
elseif x(:,1)==2
    [file,sf]=audioread('apa.wav');
elseif x(:,1)==3
    [file,sf]=audioread('ada.wav');
elseif x(:,1)==4
    [file,sf]=audioread('ata.wav');
elseif x(:,1)==5
    [file,sf]=audioread('aga.wav');
else
    [file,sf]=audioread('aka.wav');
end
[b,a]=butter(4,2000/(sf/2),'high');
file=filter(b,a,file);

[AMsig1]= AMsmear(30,1,file,sf);
[AMsig2]= AMsmear(30,3,file,sf);
std=sqrt(mean(AMsig1.*AMsig1));
sig1=AMsig1*0.99/std;
% % standard=standard';

std1=sqrt(mean(AMsig2.*AMsig2));
sig2=AMsig2*0.99/std1;

ph_sft=zeros(1,round(tl*sf));
% sig3=sig2(1:(length(sig2))-(length(ph_sft)));

% standard = GenerateEnvelope(sf, sig1,2);
% variable = GenerateEnvelope(sf, sig3,2);
% % plot(standard)
% % hold on
% % plot(variable)
% 
% std=sqrt(mean(standard.*standard));
% standard=standard*0.99/std;
% % standard=standard';
% 
% 
% var=sqrt(mean(variable.*variable));
% variable=variable*0.99/var;
% 
% % if length(standard)> length(variable)
% % variable=[ph_sft,variable,zeros(1,(length(standard))-(length(variable)))];
% % % elseif length(standard)< length(variable)
% % %     variable=variable(length(standard));
% % end
sig3=[sig1,ph_sft];
sig4=[ph_sft,sig2];
% if length(standard)> length(variable)
%     variable=[variable,zeros(1,(length(standard))-(length(variable)))];
% end
% variable=variable';
% figure
subplot(211)
plot(sig3)
subplot(212)
plot(sig4)
% 
% figure
% subplot(211)
% plot(sig1)
% subplot(212)
% plot(sig3)

standard1=[sig1',sig2'];
variable1=[sig3',sig4'];

% [variable, standard]=shufflestim(rms_sig1,rms_sig2,fs);
[sequence,pos]=shuffle(standard1,variable1,sf);
sound(sequence,sf)
% Resp= input('which interval contain target?  ');
[Resp]=resp_gui;
corrt=Resp-pos;
xx=imread('correct.JPG');
yy=imread('wrong.JPG');
if corrt==0
    cResp=1;
    figure(3)
    imshow(xx)
else
    cResp=0;
    figure(3)
    imshow(yy)
end
pause(0.2)
delete(figure(3))